<?php
$pid = pcntl_fork();
if ($pid<0){
    exit('fork error'.PHP_EOL);
}else if ($pid>0){
    cli_set_process_title("php father process");
    while (true){
        sleep(1);
        $wait_result = pcntl_waitpid($pid,$status,WNOHANG);
        echo $wait_result.PHP_EOL;
    }
}else if ($pid==0){
    cli_set_process_title("ph child process");
    sleep(20);
    exit();
}
